package com.xiaoshuidi.cloud.module.member.service.coupon;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xiaoshuidi.cloud.framework.common.pojo.PageResult;
import com.xiaoshuidi.cloud.framework.mybatis.core.util.MyBatisUtils;
import com.xiaoshuidi.cloud.module.member.controller.admin.coupon.vo.CouponRecordForm;
import com.xiaoshuidi.cloud.module.member.controller.admin.coupon.vo.CouponRecordVo;
import com.xiaoshuidi.cloud.module.member.mapper.coupon.CouponRecordMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description 优惠券记录service层
 * @author Alex
 * @date 2023-03-15 16:08:44
 * @version generator
 */
@Service
public class CouponRecordService{

    @Resource
    CouponRecordMapper baseMapper;

    /**
     * 发券记录
     */
    public PageResult<CouponRecordVo> couponRecord(CouponRecordForm form){
        IPage<CouponRecordVo> page = MyBatisUtils.buildPage(form);
        List<CouponRecordVo> list = baseMapper.selectCouponRecordPage(page, form);
        PageResult<CouponRecordVo> pageResult = new PageResult(list, page.getTotal());
        pageResult.setList(list);
        return pageResult;
    }
}

